/*
 * Created on 14.04.2011
 *
 * @author Benedikt
 *
 * createt first in Project Ch@t
 */

package window;

import general.Tree;
import interfaces.Variablen;
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import listener.MyActionListener;
import listener.MyMouseListener;

public class Fenster extends JFrame implements Variablen {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7503381741181404387L;

	public JPanel senden;
	public JButton sendeButton;
	public JTabbedPane tab;
	Tree tree;
	private static SplitPanel splitPanel;

	private MyMouseListener mml;

	public Fenster(String title, Tree tree , SplitPanel splitPanel) {
		super(title);
		
		this.tree = tree;
		Fenster.setSplitPanel(splitPanel);

		setSize(500, 500);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);

		setLayout(new BorderLayout());

		senden = new JPanel();

		sendeButton = new JButton("Senden");
		sendeButton.setActionCommand("senden");
		senden.add(sendeButton);

		MyActionListener al = new MyActionListener(splitPanel, this);

		sendeButton.addActionListener(al);



		tab = new JTabbedPane();

		add(senden, BorderLayout.SOUTH);

		add(tab, BorderLayout.CENTER);
		
		setMml(new MyMouseListener(tree, this, splitPanel));		

	}

	public void setMml(MyMouseListener mml) {
		this.mml = mml;
	}

	public MyMouseListener getMml() {
		return mml;
	}

	public static void setSplitPanel(SplitPanel splitPanel) {
		Fenster.splitPanel = splitPanel;
	}

	public static SplitPanel getSplitPanel() {
		return splitPanel;
	}

}
